69. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-03-13 03:00:44 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

69.1 Files compared

#LocationFileLast Modified
1Porto v4.0.4/Porto Theme/app/code/Mageplaza/LayeredNavigation/Model/SearchSearchCriteriaBuilder.php2022-04-22 07:34:10 +0000
2Porto v4.0.5/Porto Theme/app/code/Mageplaza/LayeredNavigation/Model/SearchSearchCriteriaBuilder.php2022-12-08 01:34:28 +0000

69.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged14164
Changed853
Inserted00
Removed540

69.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

69.4 Active regular expressions

No regular expressions were active.

69.5 Comparison detail

1 <?php 1 <?php
2 /** 2 /**
3  * Mageplaza 3  * Mageplaza
4  * 4  *
5  * NOTICE OF LICENSE 5  * NOTICE OF LICENSE
6  * 6  *
7  * This source file is subject to the Mageplaza.com license that is 7  * This source file is subject to the Mageplaza.com license that is
8  * available through the world-wide-web at this URL: 8  * available through the world-wide-web at this URL:
9  * https://www.mageplaza.com/LICENSE.txt 9  * https://www.mageplaza.com/LICENSE.txt
10  * 10  *
11  * DISCLAIMER 11  * DISCLAIMER
12  * 12  *
13  * Do not edit or add to this file if you wish to upgrade this extension to newer 13  * Do not edit or add to this file if you wish to upgrade this extension to newer
14  * version in the future. 14  * version in the future.
15  * 15  *
16  * @category    Mageplaza 16  * @category    Mageplaza
17  * @package     Mageplaza_LayeredNavigation 17  * @package     Mageplaza_LayeredNavigation
18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/) 18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
19  * @license     https://www.mageplaza.com/LICENSE.txt 19  * @license     https://www.mageplaza.com/LICENSE.txt
20  */ 20  */
21  21 
22 namespace Mageplaza\LayeredNavigation\Model\Search; 22 namespace Mageplaza\LayeredNavigation\Model\Search;
23  23 
24 use Magento\Framework\Api\Filter;    
25 use Magento\Framework\Api\ObjectFactory;    
26 use Magento\Framework\Api\Search\SearchCriteria; 24 use Magento\Framework\Api\Search\SearchCriteria;
27 use Magento\Framework\Api\Search\SearchCriteriaBuilder as SourceSearchCriteriaBuilder; 25 use Magento\Framework\Api\Search\SearchCriteriaBuilder as SourceSearchCriteriaBuilder;
28 use Magento\Framework\Api\SortOrderBuilder;    
29 use Mageplaza\LayeredNavigation\Helper\Data as LayerHelper;    
30  26 
31 /** 27 /**
32  * Builder for SearchCriteria Service Data Object 28  * Builder for SearchCriteria Service Data Object
33  */ 29  */
34 class SearchCriteriaBuilder extends SourceSearchCriteriaBuilder 30 class SearchCriteriaBuilder extends SourceSearchCriteriaBuilder
35 { 31 {
36     /** 32     /**
37      * @var LayerHelper as LayerHelper; 33      * @var array
38      */ 34      */
39     protected $helper; 35     private $filters = [];
40  36 
41     /** 37     /**
42      * SearchCriteriaBuilder constructor. 38      * Builds the SearchCriteria Data Object
43      * 39      *
44      * @param LayerHelper $helper 40      * @return SearchCriteria
45      * @param ObjectFactory $objectFactory    
46      * @param FilterGroupBuilder $filterGroupBuilder    
47      * @param SortOrderBuilder $sortOrderBuilder    
48      */ 41      */
49     public function __construct(
 42     public function create()
50         LayerHelper $helper, 43     {
51         ObjectFactory $objectFactory, 44         foreach ($this->filters as $filter) {
52         FilterGroupBuilder $filterGroupBuilder, 45             $this->data[SearchCriteria::FILTER_GROUPS][] = $this->filterGroupBuilder->setFilters([])
53         SortOrderBuilder $sortOrderBuilder 46                 ->addFilter($filter)
54     ) { 47                 ->create();
55         $this->helper = $helper; 48         }
56  49 
57         parent::__construct($objectFactory, $filterGroupBuilder, $sortOrderBuilder); 50         return parent::create();
    51     }
    52 
    53     /**
    54      * Create a filter group based on the filter array provided and add to the filter groups
    55      *
    56      * @param \Magento\Framework\Api\Filter $filter
    57      * @return \Magento\Framework\Api\Search\SearchCriteriaBuilder
    58      */
    59     public function addFilter(\Magento\Framework\Api\Filter $filter)
    60     {
    61         $this->filters[] = $filter;
    62         return $this;
58     } 63     }
59  64 
60     /** 65     /**
61      * @param $attributeCode 66      * @param $attributeCode
62      * 67      *
63      * @return $this 68      * @return $this
64      */ 69      */
65     public function removeFilter($attributeCode) 70     public function removeFilter($attributeCode)
66     { 71     {
67         $this->filterGroupBuilder->removeFilter($attributeCode); 72         foreach ($this->filters as $key => $filter) {
    73             if ($filter->getField() == $attributeCode) {
    74                 unset($this->filters[$key]);
    75                 break;
    76             }
    77         }
68  78 
69         return $this; 79         return $this;
70     } 80     }
71  81 
72     /** 82     /**
73      * @param $categoryIds 83      * @param $categoryIds
74      * 84      *
75      * @return $this 85      * @return $this
76      */ 86      */
77     public function setCategoryFilter($categoryIds) 87     public function setCategoryFilter($categoryIds)
78     { 88     {
79         $this->filterGroupBuilder->setCategoryFilter($categoryIds); 89         foreach ($this->filters as $key => $filter) {
    90             if ($filter->getField() === 'category_ids') {
    91                 $filter->setValue($categoryIds);
    92                 break;
    93             }
    94         }
80  95 
81         return $this; 96         return $this;
82     } 97     }
83  98 
84     /** 99     /**
85      * @return SearchCriteriaBuilder 100      * @return SearchCriteriaBuilder
86      */ 101      */
87     public function cloneObject() 102     public function cloneObject()
88     { 103     {
89         $cloneObject = clone $this; 104         $cloneObject = clone $this;
90         $cloneObject->setFilterGroupBuilder($this->filterGroupBuilder->cloneObject());    
91  105 
92         return $cloneObject; 106         return $cloneObject;
93     } 107     }
94  108 
95     /** 109     /**
96      * @param $filterGroupBuilder    
97      */    
98     public function setFilterGroupBuilder($filterGroupBuilder)    
99     {    
100         $this->filterGroupBuilder = $filterGroupBuilder;    
101     }    
102     
103     /**    
104      * Return the Data type class name 110      * Return the Data type class name
105      * 111      *
106      * @return string 112      * @return string
107      */ 113      */
108     protected function _getDataObjectType() 114     protected function _getDataObjectType()
109     { 115     {
110         return SearchCriteria::class; 116         return SearchCriteria::class;
111     } 117     }
112     
113     /**    
114      * Builds the SearchCriteria Data Object    
115      *    
116      * @return SearchCriteria    
117      */    
118     public function create()    
119     {    
120         $this->data[SearchCriteria::FILTER_GROUPS] = [$this->filterGroupBuilder->create()];    
121         $this->data[SearchCriteria::SORT_ORDERS] = [$this->sortOrderBuilder->create()];    
122     
123         return parent::create();    
124     }    
125     
126     /**    
127      * Create a filter group based on the filter array provided and add to the filter groups    
128      *    
129      * @param Filter $filter    
130      *    
131      * @return $this    
132      */    
133     public function addFilter(Filter $filter)    
134     {    
135         $this->filterGroupBuilder->addFilter($filter);    
136     
137         return $this;    
138     }    
139 } 118 }